public class PetServlet2 implements Servlet{
    @Override
    public void doGet(Request request, Response response) throws Exception {
        System.out.println("legs     "+request.getParameter("legs").trim());
        System.out.println("weight   "+request.getParameter("weight").trim());
        int legs= Integer.parseInt(request.getParameter("legs").trim());
        int weight= Integer.parseInt(request.getParameter("weight").trim());
        if (legs == 0) {
            request.setAttribute("pet", "a goldfish");
        } else {
            if (legs == 4) {
                if (weight < 20) {
                    request.setAttribute("pet", "a cat");
                }

                if (weight < 100) {
                    request.setAttribute("pet", "a dog");
                }
            }
            request.setAttribute("pet", "a house plant");
        }


        System.out.println("进入PetServlet");
        JspServlet jspServlet = new JspServlet();
        jspServlet.setPath("WebContent/show3.jsp");
        jspServlet.doGet(request,response);
    }

    @Override
    public void doPost(Request request, Response response) throws Exception {
        doGet(request,response);
    }
}
